package com.cxso.example.sdk.http.core;


import com.cxso.example.enums.ProductClientEnum;
import com.cxso.example.sdk.http.base.ClientInfo;
import com.cxso.example.sdk.http.base.HttpMethod;

import java.util.HashMap;
import java.util.Map;

public class ExecuteClient extends AbstractClient {


    public ExecuteClient(ClientInfo clientInfo) {
        super(clientInfo);
    }

    public ExecuteClient setHeaders(HashMap<String, String> headers) {
        this.headers = headers;
        return this;
    }

    public ResultResolver execute(String path, HttpMethod httpMethod, Object param) {
        return execute(path, httpMethod, param, null);
    }

    public ResultResolver execute(String path, HttpMethod httpMethod, Object param, Map<String, String> query) {
        String result = rpcInvoke(httpMethod, path, param, query, clientInfo.getProductClientId().equals(ProductClientEnum.MERGE_ENTERPRISE.getCode()));
        return new ResultResolver(this.clientInfo, result);
    }

}
